package com.kedacom.freedomLabel.initdata.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.kedacom.freedomLabel.initdata.bean.CategoryNewBean;
import com.kedacom.freedomLabel.initdata.bean.RubbishBean;
import com.kedacom.freedomLabel.model.bean.ProductCount;
import com.kedacom.freedomLabel.model.db.dao.IDao;

import java.util.List;


/**
 * Created by yao on 2021/3/23.
 * Describe
 */

@Dao
public interface CategoryNewDao extends IDao<CategoryNewBean>{

    @Override
    @Query("SELECT COUNT(0) FROM CategoryNewBean")
    int count();


    @Override
    @Update
    void update(CategoryNewBean data);

    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long save(CategoryNewBean data);


    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long[] save(List<CategoryNewBean> data);


    @Override
    @Query("SELECT * FROM  CategoryNewBean  ORDER BY otherId ")
    List<CategoryNewBean> get();

    @Override
    @Query("SELECT * FROM CategoryNewBean WHERE name LIKE  '%' || :param || '%'  ")
    List<CategoryNewBean> get(String param);

    @Override
    @Query("SELECT * FROM CategoryNewBean WHERE name=:param1 or name LIKE :param2")
    List<CategoryNewBean> get(String param1, String param2);

    @Override
    @Delete
    void delete(CategoryNewBean data);

    @Override
    @Query("DELETE FROM CategoryNewBean")
    void delete();

    @Override
    @Query("DELETE FROM CategoryNewBean WHERE name=:param ")
    void delete(String param);

}